Conversation
Greptile SummaryThis PR fixes a bug where command records were filtered out during proto deserialization (inside The fix correctly defers filtering to after all limit-tracking state is applied, adds Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant run_read_session
participant Server
Server-->>run_read_session: ReadBatch (data + command records)
Note over run_read_session: read_batch_from_proto() — full unfiltered batch
run_read_session->>run_read_session: Update seq_num (last unfiltered record)
run_read_session->>run_read_session: Decrement remaining_count / remaining_bytes (full batch)
alt "ignore_command_records=True"
run_read_session->>run_read_session: Filter out command records
alt filtered batch has records
run_read_session-->>Caller: yield ReadBatch (data records only)
else all records were command records
Note over run_read_session: batch dropped silently — limits already tracked
end
else "ignore_command_records=False"
run_read_session-->>Caller: yield ReadBatch (all records)
end
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/s2_sdk/_s2s/_read_session.py
Line: 106-115
Comment:
**No tests cover `ignore_command_records` filtering**
There are no tests exercising the `ignore_command_records=True` path in `run_read_session` — neither the limit-tracking fix (the core bug) nor the suppression of empty post-filter batches. A regression here would be silent. Consider adding at least one unit/integration test that verifies a session with a mix of command and data records correctly decrements `remaining_count`/`remaining_bytes` against the full (unfiltered) record count and only yields batches containing data records.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "initial commit" | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.